<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const str1 = "name";
      const str2 = () => "age";
      const str3 = "max";
      const str4 = "age";
      const user = {
        [str1]: "jack", // "name":"jack"
        [str2()]: 20,
        [str3 + " " + str4]: 30,
      };
      console.log(user);
      console.log(user[str1]);
      console.log(user[str2()]);
    </script>
  </body>
</html>
